<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text">
    <p>111</p>
    <script>
        // var reg = /^\d{3,4}-\d{7,8}$/
        // var reg1 = /^\d{3}-\d{7}$|^\d{4}-\d{8}$/
        var reg2 = /^1[3-9]\d{9}$/
        var inp = document.querySelector('input')
        var p = document.querySelector('p')
        inp.onblur = function () {
            if (reg2.test(this.value)) {
                console.log("正确");
                p.innerText = '输入正确'
            } else {
                console.log("错误");
                p.innerText = '输入错误'
            }
        }
    </script>
</body>

</html>